package com.xinshujia.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xinshujia.entity.QuartzEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * *************************************
 * *   @author: 野狼上校               **
 * *   @since: 2024-07-20 17:11       **
 * *   @version: 1.0                  **
 * *************************************
 * <p>
 * 定时任务持久化
 */
@Mapper
public interface QuartzDao extends BaseMapper<QuartzEntity> {
    // 查询是否存在该设备的定时任务
    @Select("SELECT * FROM blade_quartz WHERE job_name = #{deviceGuid};")
    QuartzEntity findQuartzByDeviceGuid(@Param("deviceGuid") String deviceGuid);

    // 根据 jobName 删除定时任务
    @Select("DELETE FROM blade_quartz WHERE job_name = #{deviceGuid};")
    void deleteByDeviceGuid(String deviceGuid);
}
